<?php
/**
 * @version		$Id: content.php 17085 2010-05-16 00:03:00Z severdia $
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;

/**
 * @package		Joomla.Administrator
 * @subpackage	com_content
 */
abstract class JHtmlAjaxWhois
{
	/**
	 * @param	int $value	The state value
	 * @param	int $i
	 */
	function featured($value = 0, $i, $canChange = true)
	{
		// Array of image, task, title, action
		$states	= array(
			0	=> array('disabled.png',	'articles.featured',	'COM_CONTENT_UNFEATURED',	'COM_CONTENT_TOGGLE_TO_FEATURE'),
			1	=> array('featured.png',		'articles.unfeatured',	'COM_CONTENT_FEATURED',		'COM_CONTENT_TOGGLE_TO_UNFEATURE'),
		);
		$state	= JArrayHelper::getValue($states, (int) $value, $states[1]);
		$html	= JHTML::_('image','admin/'.$state[0], JText::_($state[2]), NULL, true);
		if ($canChange) {
			$html	= '<a href="javascript:void(0);" onclick="return listItemTask(\'cb'.$i.'\',\''.$state[1].'\')" title="'.JText::_($state[3]).'">'
					. $html.'</a>';
		}

		return $html;
	}

	/**
	 * Displays the publishing state legend for articles
	 */
	function Legend()
	{
		?>

		<div class="center">
			<ul id="legend articles">
				<li><?php echo JHTML::_('image','admin/publish_y.png', JText::_('Pending'), array('width' => 16, 'height' => 16, 'border' => 0), true)?></li>
				<li><?php echo JText::_('PUBLISHED_BUT_IS'); ?> <u><?php echo JText::_('Pending'); ?></u></li>
				<li><?php echo JHTML::_('image','admin/publish_g.png', JText::_('Visible'), array('width' => 16, 'height' => 16, 'border' => 0), true)?></li>
				<li><?php echo JText::_('PUBLISHED_AND_IS'); ?> <u><?php echo JText::_('Current'); ?></u></li>
				<li><?php echo JHTML::_('image','admin/publish_r.png', JText::_('Finished'), array('width' => 16, 'height' => 16, 'border' => 0), true)?></li>
				<li><?php echo JText::_('PUBLISHED_BUT_HAS'); ?> <u><?php echo JText::_('Expired'); ?></u></li>
				<li><?php echo JHTML::_('image','admin/publish_x.png', JText::_('Finished'), array('width' => 16, 'height' => 16, 'border' => 0), true)?></li>
				<li><?php echo JText::_('NOT_PUBLISHED'); ?></li>
				<li><?php echo JHTML::_('image','admin/disabled.png', JText::_('JARCHIVED'), array('width' => 16, 'height' => 16, 'border' => 0), true)?></li>
				<li><?php echo JText::_('JARCHIVED'); ?></li>
			</ul>
			<p class="center"><?php echo JText::_('JGLOBAL_CLICK_TO_TOGGLE_STATE'); ?></p>
		</div>
<?php }

	function icons() {
		$prefix = "COM_AJAXWHOIS_";
		$links = array(	array( 'settings', JText::_( $prefix."COMMON_SETTINGS" ), JText::_( $prefix."PAYPAL_SETTINGS" )."::".JText::_( "Set here your PayPal eMail ID, Language, Currency etc." ) ),
						array( 'configs', JText::_( $prefix."CONFIG" ), JText::_( $prefix."CONFIG" )."::".JText::_( "Set the configuration for yousr Ajax Whois Component Pages." ) ),
						array( 'links', JText::_( $prefix."VARIOUS_LINKS" ), JText::_( $prefix."VARIOUS_LINKS" )."::".JText::_( "This is the integration point for Ajax Whois and your domain registration pages." ) ),
						array( 'extensions', JText::_( $prefix."EXTENSIONS" ), JText::_( $prefix."EXTENSIONS" )."::".JText::_( "Many extensions are already added to AjaxWhois. However you can add more extensions or edit the older ones." ) ),
						array( 'domains', JText::_( $prefix."DOMAINS_SERVED" ), JText::_( $prefix."LIST_OF_DOMAINS_CHECKED" )."::".JText::_( "The list of domains checked for availability / whois on your website (if you are storing domains)." ) ),
						array( 'invoices', JText::_( $prefix."DOMAIN_INVOICES" ), JText::_( $prefix."INVOICES" )."::".JText::_( "If you are receiving orders using the domain registration extension of Ajax Whois." ) )
		);
		return $links;
	}

	function panes() {
		$paneContent = array( 
		//PaneContent[0]
		'<div style="padding:5px;">'.
          '<p>'.
		  	JText::_( 'COM_AJAXWHOIS_INTRO' ).
		  '</p><p>'.
		    JText::_( 'COM_AJAXWHOIS_EXTRA' ).
		  '</p><p>'.
		    JText::_( 'COM_AJAXWHOIS_INTEGRATE' ).
		  '</p>'.
          '<blockquote style="border:1px solid; background:#FF6;padding:10px;width:auto;">'.
            '<b>'.
				JText::_( 'COM_AJAXWHOIS_NOTE' ).
			'</b>: '.
			JText::_( 'COM_AJAXWHOIS_TIPS_PROVIDED' ).
			' <a href="http://www.softuff.org/Support.html">'.
				JText::_( 'SOFTUFF_SUPPORT_SECTION' ).
			'</a> '.
			JText::_( 'IF_STRUC' ).
          '</blockquote>'.
		'</div>',
		//PaneContent[1]
		'<div style="padding:5px;">'.
		  '<h2>'.
			JText::_( 'COM_AJAXWHOIS_FEATURE_PACKED' ).
		  '</h2>'.
		  '<ul>'.
			'<li>'.
				JText::_( 'Six_Hundred_Extensions' ).
			'</li>'.
			'<li>'.
				JText::_( 'Covering_many_Extensions_where_no_public_whois_servers_available' ).
			'</li>'.
			'<li>'.
				JText::_( 'BYEPASS_WHOIS_QUERIES_IF_PORT_43_IS_BLOCKED' ).
			'</li>'.
			'<li>'.
				JText::_( 'Display_Multiple_Configurations_with_varying_extensions' ).
			'</li>'.
			'<li>'.
				JText::_( 'Different_Exstensions_of_different_Pages_Module_or_Component' ).
			'</li>'.
			'<li>'.
				JText::_( 'Display_Extensions_Selected_All_Continent_Wise_Country_Wise_Alphabetical' ).
			'</li>'.
			'<li>'.
				JText::_( 'Integration_Support_to_various_registrars_and_billing_systems' ).
			'</li>'.
			'<li>'.
				JText::_( 'Various_Registration_Pages' ).
			'</li>'.
			'<li>'.
				JText::_( 'Control_the_delay_of_domain_search_while_your_customers_type_down' ).
			'</li>'.
			'<li>'.
				JText::_( 'Professional_Look_Feel' ).
			'</li>'.
			'<li>'.
				JText::_( 'Have_different_Styles_for_different_Pages' ).
			'</li>'.
			'<li>'.
				JText::_( 'Compatible_with_Internet_Explorer_FireFox_Opera_Safari_Chrome_almost_all_browsers_and_Platforms' ).
			'</li>'.
			'<li>'.
				JText::_( 'CSS_3_and_XHTML_1_Transitional_Validated' ).
			'</li>'.
		  '</ul>'.
		'</div>', 
		//PaneContent[2]
		'<div style="padding:5px;">'.
          '<p>'.
		  JText::_( 'FOLLOW_STEPS' ).
		  '</p>'.
          '<ol>'.
			'<li>'.
			JText::_( 'GOTO_EXTENSION_MANAGER' ).
			'</li>'.
			'<br />'.
			'<li>'.
             JText::_( 'GOTO_CONFIG' ).
			  '<blockquote style="border:1px solid; background:#FF6;padding:10px;width:auto;">'.
			  '<b>'.
			  	JText::_( 'NOTE' ).
			  '</b>'.
			  JText::_( 'DONOT_PUBLISH_MODULE_ON_COMPONENT_PAGE' ).
			  '</blockquote>'.
			  '<blockquote>'.
			  	JText::_( 'USE_MODULE_CONFIG' ).
			  '</blockquote>'.
			  '<blockquote style="border:1px solid; background:#FF6;padding:10px;width:auto;">'.
			  '<b>'.
			  	JText::_( 'NOTE' ).
			  '</b>'.
			  JText::_( 'DONOT_PUBLISH_MODULE_ON_MODULE_PAGE' ).
			  '</blockquote>'.
            '</li>'.
			'<li>'.
			JText::_( 'CONFIG_LINKS' ).
			  '<blockquote>'.
                JText::_( 'PASS_DOMAIN' ).
				'<br />'.
                '<blockquote>'.
                   '%domainname% and %tld%'.
                '</blockquote>'.
				JText::_( 'IN_PLACE_OF_DOMAIN' ).
				'<br /><br />'.
				JText::_( 'EXAMPLE' ).
				'<br />'.
				'<blockquote>'.
                   'http://softuff.org/index.php?option=com_ajaxwhois&task=regDomain&domain=%domainname%.%tld%'.
                '</blockquote>'.
				JText::_( 'RUN_TIME' ).
              '</blockquote>'.
            '</li>'.
          '</ol>'.
		'</div>' );
		return $paneContent;
	}

	function quickiconButton( $link, $image, $text, $hideMenu = false, $tip ) {
		if ( $hideMenu ) {
			$hideMenu = '&amp;hidemainmenu=1';
		} ?>
		<div class="icon">
			<a href="<?php echo $link . $hideMenu; ?>">
              <span class="editlinktip hasTip" title="<?php echo $tip; ?>">
            	<img src="<?php echo JURI::root(); ?>/media/com_ajaxwhois/images/<?php echo $image; ?>" />
				<span><?php echo $text; ?></span>
              </span>
			</a>
		</div><?php
	}

	function tipStyle() { ?>
    <style type="text/css">
		#cpanel div.icon a {
			width:120px;
		}
		#filter-bar {
			height:50px !important;
		}
		fieldset#filter-bar label {
			margin:2px !important;
		}
		fieldset#filter-bar input, fieldset#filter-bar select {
			margin:2px !important;
		}
		#filter-bar input.short {
			width:65px;
		}
		#filter-bar input.medium {
			width:115px;
		}
		#filter-bar input.long {
			width:150px;
		}
		table.admintable td {
			height:25px;
			vertical-align:middle;
			text-align:left;
		}
		table.admintable td.fieldset {
			height:25px;
			vertical-align:top;
		}
		table.admintable td.key {
			height:25px;
			vertical-align:middle;
			border:0px solid;
			background:none;
			width:200px;
		}
		table.admintable td.key.top {
			vertical-align:top;
			padding-top:6px;
		}
		table.admintable th {
			height:25px;
			vertical-align:middle;
			text-align:center;
		}
		table.admintable td.right {
			text-align:center;
		}
		table.admintable td.right input {
			text-align:right;
		}
		td.right, th.right {
			float:right;
		}
		.editlinktip {
			padding:3px 16px 3px 0px;
			background:url(<?php echo JURI::root(); ?>media/com_ajaxwhois/images/notknown.png) 100% 50% no-repeat;
		}
		#cpanel span.editlinktip, 
		table.adminheading span.editlinktip {
			padding:0;
			background:none;
		}
		.tool-tip {
			max-width: 400px;
		}
		.awGeneral, .awPaypal, .awDomain, .awExtensions, .awHosting {
			background:#EEEEDD url(<?php echo JURI::root(); ?>media/com_ajaxwhois/images/lowerright.png) 100% 100% no-repeat;
			border-bottom:3px solid #999988;
			float:left;
			margin:10px;
			padding:10px;
			width:auto;
		}
		.editNF {
			background:url(<?php echo JURI::root(); ?>media/com_ajaxwhois/images/edit_pencil.gif) 0 0 no-repeat;
			width:16px;
			height:16px;
			display:block;
			float:left;
			margin:5px;
		}
		.awHosting {
			width:80%;
		}
		.pane-sliders .content {
			background:#fff;
		}
		.item {
			width:80px;
			display:block;
			float:left;
		}
		.desc {
			width:70%;
			display:block;
			float:left;
		}
		.flag {
			width:16px;
			height:11px;
			margin:1px;
			float:left;
			display:block;
			background: url(<?php echo JURI::root(); ?>media/com_ajaxwhois/images/flags.png) -10% -10% no-repeat; 
		}
		
		.asia { background-position:0 0; }
		
		<?php 
		for ($i = 1; $i <= 26; $i++) {
			for ($j = 1; $j <= 26; $j++) {
				$country = chr(96+$i).chr(96+$j);
				$x = -($j-1) * 16;
				$y = -($i-1) * 11;
				$flag = ".".$country." { background-position: ".$x."px ".$y."px; }\n";
				echo $flag;
			}
		}
		?>
	</style><?php
	}
	
	function powered() { 
		$version = AjaxWhoisHelper::version(); ?>
		<table class="adminheading" style="width:100%;">
		  <tr>
			<td style="text-align:center;font-weight:normal;">
		  	  Powered by: 
          	  <a rel="nofollow" href="http://www.softuff.org" target="_blank">
            	<span class="editlinktip hasTip" title="<?php echo 'Softuff eDevelopment'; ?>::<?php echo JText::_( 'ABOUT_US' ); ?>">
                  Softuff
            	</span>
          	  </a>
          	  's AjaxWhois <?php echo JText::_( 'PRO' ); ?> <?php echo $version[1] ?>
			</td>
		  </tr>
        </table>
<?php 
	}

	public static function versionc() {
		$c = 'PGEgc3R5bGU9ImRpc3BsYXk6bm9uZTsiIGhyZWY9Imh0dHA6Ly93d3cuc29mdHVmZi5vcmcvIiB0aXRsZT0iU29mdHVmZidzIEFqYXggV2hvaXMiIHRhcmdldD0iX2JsYW5rIiByZWw9Im5vZm9sbG93Ij5BamF4IFdob2lzPC9hPg==';
		return base64_decode($c);
	}

}